<?php

namespace app\api\model;

use think\Model;
use traits\model\SoftDelete;

class RealOrder extends Model
{
    use SoftDelete;

    protected $deleteTime = 'deletetime';

    protected $hidden = ['deletetime', 'createtime', 'updatetime'];

    public static function getByOrderNo($order_no)
    {
        return self::where('order_no', $order_no)->find();
    }

    public function service()
    {
        return $this->hasMany(RealOrderService::class, 'order_id', 'id');
    }

    public function user()
    {
        return $this->hasOne(Users::class, 'id', 'user_id');
    }

}
